package com.tz.cartelo.activity;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.tz.cartelo.BaseApplication;
import com.tz.cartelo.R;
import com.tz.cartelo.constant.Key;
import com.tz.common.util.PreferencesUtils;

/**
 * Created by Administrator on 2017/4/16.
 */

public class ManagerSetActivity extends DataLoadActivity implements View.OnClickListener {

    private TextView mManagerSetUserName, managerSetCompany, managerSetPhone;

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_manager_set;
    }

    @Override
    protected void init() {
        BaseApplication.addActivity(this);
        mManagerSetUserName = (TextView) findViewById(R.id.manager_set_user_name);
        managerSetCompany = (TextView) findViewById(R.id.manager_set_company);
        managerSetPhone = (TextView) findViewById(R.id.manager_set_phone);
        mManagerSetUserName.setText(PreferencesUtils.getString(Key.PER_USER_NICK, ""));
        managerSetCompany.setText(PreferencesUtils.getString(Key.PER_USER_COMPANY, ""));
        managerSetPhone.setText(PreferencesUtils.getString(Key.PER_USER_PHONE, ""));

        findViewById(R.id.manager_set_change_phone_layout).setOnClickListener(this);
        findViewById(R.id.manager_set_change_password_layout).setOnClickListener(this);

    }

    @Override
    protected void initTitle() {
        ImageView titleBack = (ImageView) findViewById(R.id.title_back);
        titleBack.setVisibility(View.VISIBLE);
        titleBack.setOnClickListener(this);

        TextView titleText = (TextView) findViewById(R.id.title_text);
        titleText.setText(R.string.manager_center_system_set);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.title_back:
                finish();
                break;
            case R.id.manager_set_change_phone_layout:
                switchActivity(BindPhoneActivity.class, null);
                break;
            case R.id.manager_set_change_password_layout:
//                switchActivity(ChangePasswordActivity.class, null);
                switchActivity(ChangePhoneActivity.class, null, Key.CHANGE_PASSWORD_CHANGE_PHONE);
                break;
            default:
                break;
        }

    }

}
